package org.xiaoyu.rpc.protocol;

import io.netty.channel.Channel;
import org.xiaoyu.rpc.Exporter;
import org.xiaoyu.rpc.Invoker;
import org.xiaoyu.rpc.common.exception.RpcException;
import org.xiaoyu.rpc.common.extension.annotations.SPI;
import org.xiaoyu.rpc.remoting.packet.Invocation;

/**
 * Created By Have
 * 2021/7/12 20:58
 */
@SPI("rpc")
public interface Protocol {
    int getDefaultPort();

    <T> Exporter<T> export(Invoker<T> invoker) throws RpcException;

    void destroy();

    Invoker<?> getInvoker(Channel channel, Invocation invocation);
}

